<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<script>
var brandSet = new Set();
function searchBrand(){	
		var brandS = $("#brandName").val();

        $('#dataGridBrand').datagrid({
    		url : 'productJSONAction!listBrandsDataByPage',    		
    	    queryParams: {
    	    	'formBean.brandName':brandS,    	    	
    	    },
    		fit : true,
    		fitColumns : true,
    		pagination : true,
    		pageSize : 15,
    		pageList : [ 15, 20],
    		border : false,
    		checkOnSelect : true,
    		selectOnCheck : true,
    		singleSelect: false,
    		showFooter:true,
    		rownumbers:true,
    		nowrap : false,
    		columns : [[    					   				
    					{field:'brand_Name', width:220,title:'品牌名称',fixed:true},	
						{field:'supplier', width:260,title:'供应商',fixed:true},
						{field:'comment', width:200,title:'备注',fixed:true},
						{field:'pinyin', width:100,title:'拼音',fixed:true},
						{field:'belong_To', width:90,title:'归属',fixed:true},						
						 {				
							field : 'action',
							title : '选择',
							width : 60,
						formatter : function(value, row, index) {							
							var str = '';
							str += $.formatString('<a href="#" onclick="selectHqBrand(\'{0}\',\'{1}\');"><img border="0" src="{2}" title="品牌"/></a>', row.brand_ID,row.brand_Name,'<%=request.getContextPath()%>/conf_files/easyUI/themes/icons/select.png');
							return str;
						}},
    			     ]],	    
    	});
        
        $("#brandDiv").dialog("open");
}
function selectHqBrand(brandId,brandName){
	if (brandName != "" && brandId != "" && brandId != 0){
        $("#brandName").textbox('setValue',brandName);
        $("#brand_ID").val( brandId);

        $("#brandName").attr("disabled", "disabled");
        $("#searchBt").attr("disabled", "disabled");
        $("#clearBt").removeAttr("disabled");
        $("#brandDiv").dialog("close");
    }
}




</script>

<s:form id="brandForm" name="brandForm" action="" theme="simple" method="POST">

	<table  border="0"  class="InnerTableContent">
		<tr>			
			<td width="170">
				<s:textfield cssClass="easyui-searchbox" id="brandName" name="formBean.productBarcode.product.brand.brand_Name"   style="width:135px;" data-options="prompt:'请输入品牌名',searcher:searchBrand"/>
				<s:hidden name="formBean.productBarcode.product.brand.brand_ID" id="brand_ID" />
			</td>										
		</tr>
		</table>

</s:form>
<input type="hidden" id="brands" name="formBean.brandIds"/>
<!-- 查找品牌 -->
<div id="brandDiv" class="easyui-dialog" style="width: 1050px; height: 550px" data-options="title:'查找品牌',modal:false,closed:true,resizable:true">				
		    <div id="cc" class="easyui-layout" style="width:990px;height:500px; position: relative; top:5px;">
		    
		    	<table id="dataGridBrand" border="0" >
				</table>
		    </div>


</div>

</div>